package 笔试记录.M9day14途虎;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    static List<Integer> list = new ArrayList<>();
    static List<List<Integer>> lists = new ArrayList<>();
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();//左边界
        int n = sc.nextInt();//右边界
        int[] arr = new int[n - m + 1];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = m;
            m++;
        }
        backStacking(arr);
        for (int i = 0; i < lists.size(); i++) {
            String s = "";
            for (int j = 0; j < lists.get(i).size(); j++) {
                s += lists.get(i).get(j);
            }
            System.out.println(s);
        }

    }

    public static void backStacking(int[] arr){
        if(list.size() == arr.length){
            lists.add(new ArrayList<>(list));
        }

        for (int i = 0; i < arr.length; i++) {
            if(list.contains(arr[i])) continue;
            list.add(arr[i]);
            backStacking(arr);
            list.remove(list.size() - 1);
        }
    }
}
